
/**
 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Autogenerated file -- DO NOT EDIT!

#include <array>
#include <memory>
#include <unordered_map>
#include "macros.h"
#include "source_lang_enum.h"
#include "verification/plugins.h"
#include "verification/default_plugin.h"
% Common::plugins.each do |plugin_lang, plugin_opts|
%   next unless plugin_opts["Verification"]
%   if plugin_opts["Verification"]["header"]
#include "<%= plugin_opts["Verification"]["header"] %>"
%   end
% end

// NOLINTBEGIN(fuchsia-statically-constructed-objects)
namespace panda::verifier::plugin {

% Common::plugins.each do |plugin_lang, plugin_opts|
%   next unless plugin_opts["Verification"]
%   if plugin_opts["Verification"]["header"]
static <%= plugin_opts["Verification"]["plugin_class"] %> <%= plugin_lang %>_PLUGIN;
%   end
% end
static DefaultPlugin DFLT;

static std::unordered_map<panda_file::SourceLang, Plugin const *> const PLUGINS_MAP {
% Common::plugins.each do |plugin_lang, plugin_opts|
%   short_plugin_lang = plugin_lang == "JAVA" ? "JAVA_8" : plugin_lang
%   next unless plugin_opts["Verification"]
%   if plugin_opts["Verification"]["plugin_class"]
  { panda_file::SourceLang::<%= short_plugin_lang %>,
    &<%= plugin_lang %>_PLUGIN },
%   end
% end
  { panda_file::SourceLang::PANDA_ASSEMBLY, &DFLT}
};

// NOLINTEND(fuchsia-statically-constructed-objects)
Plugin const *GetLanguagePlugin(panda_file::SourceLang lang)
{
    if (PLUGINS_MAP.count(lang) > 0) {
        return PLUGINS_MAP.at(lang);
    }
    return &DFLT;
}

} // namespace panda::verifier::plugin
